package com.qf.controller;

import com.alibaba.fastjson.JSON;
import com.qf.entity.User;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/*
杨威
2021/9/23
19:34
*/
@WebServlet("/testJson")
public class TestJsonController extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("111");
        User user=new User("tom","123456");
        String s = JSON.toJSONString(user);
        response.getWriter().println(s);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request, response);
    }
}
